
$(function(){
    $("#table1").bootstrapTable({
        url:'',
        columns: [{
            field: 'id',
            title: 'id',
            visible : false,
        },{
            field: 'lasttime',
            title: '上次读数'
        },{
            field: 'sdate',
            title: '上次日期'
        },{
            field: 'jdate',
            title: '缴费期限'
        },{
            field: 'costitem.name',
            title: '收费名称'
        },{
            field:'num',
            title:'用量',
        },{
            field:'zmoney',
            title:'金额',
        },{
            field:'type',
            title:'是否缴费',
            formatter: function (value, row, index) {
                if(row.type==1){
                    return "未交费";
                }else if(row.type==2){
                    return "已缴费";
                }
            }

        }
        ],
        height:310
    })
    $("#table2").bootstrapTable({
        url:'',
        columns: [{
            field: 'id',
            title: 'id',
            visible : false,
        },{
            field: 'lasttime',
            title: '上次读数'
        },{
            field: 'sdate',
            title: '上次日期'
        },{
            field: 'jdate',
            title: '缴费期限'
        },{
            field: 'costitem.name',
            title: '收费名称'
        },{
            field:'num',
            title:'用量',
        },{
            field:'zmoney',
            title:'金额',
        },{
            field:'type',
            title:'是否缴费',
            formatter: function (value, row, index) {
                if(row.type==1){
                    return "未交费";
                }else if(row.type==2){
                    return "已缴费";
                }
            }

        }
        ],
        height:310
    })
})

function cha() {
    var xuan = $("#men").val();

    if(xuan==-1){
        sweetAlert("请选择门牌号")
    }else{
        $.post("${pageContext.request.contextPath}/../../house/numbercha",{"number":xuan},function (date) {
            var fan = eval(date);
            $.post("${pageContext.request.contextPath}/../../srecord/cc2",{"orderid":fan[0].id,"type":1},function(date1){
                $("#table1").bootstrapTable("load",date1);
            })
            $.post("${pageContext.request.contextPath}/../../srecord/cc2",{"orderid":fan[0].id,"type":-1},function (date1){
                $("#table2").bootstrapTable("load",date1)
            })

            console.log(fan)
            $("#bh").text(fan[0].userdetails.id);
            $("#name").text(fan[0].userdetails.name);
            $("#zt").text(fan[0].userdetails.property.name);
            $("#phone").text(fan[0].userdetails.phone);

            if(fan[0].userdetails.rundate==null){
                $("#date").text("暂未入住");
            }else{
                $("#date").text(fan[0].userdetails.rundate);
            }
            $("#sfz").text(fan[0].userdetails.sfz);
            $("#chanquan").text("购买");
            var xx ="百家小区 "+fan[0].sale.name+" "+fan[0].danyuan.name+" "+fan[0].floor+"层 "+fan[0].doornumber+"号"
            $("#xinxi").text(xx);
            $("#type").text(fan[0].typeb.name);
            $("#cx").text(fan[0].direction.name);
            $("#hx").text(fan[0].huxing.name);
            $("#mj").text(fan[0].measure+"平方米")
        })









    }










}